import { type FieldRule, showToast } from 'vant'

// 提供校验规则
const mobileRules: FieldRule[] = [
  {
    validator: (val) => {
      if (!/^1[3-9]\d{9}$/.test(val)) {
        showToast('请填写正确的手机号')
        return false
      }
      return true
    }
  }
]

const passwordRules: FieldRule[] = [
  {
    validator: (val) => {
      if (!/^\w{6}$/.test(val)) {
        showToast('请填写正确密码')
        return false
      }
      return true
    }
  }
]

export { mobileRules, passwordRules }
